package edu.hawaii.halealohacli.kmj;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.wattdepot.client.WattDepotClient;

/**
 * Tests the MonitorPower class.
 * @author Eldon Visitacion
 */
public class TestMonitorPower {
  WattDepotClient client = new WattDepotClient("http://server.wattdepot.org:8190/wattdepot/");
  MonitorPower mp = new MonitorPower(client, "Lokelani");
  
  /**
   * Tests a power reading.
   */
  @Test
  public void testPowerReading() {
    assertTrue("Power should be greater than zero", mp.getPower() > 0);
  }
  
  /**
   * tests the name reading.
   */
  @Test
  public void testNameReading() {
    assertTrue("Name should equal Lokelani", mp.getName().equals("Lokelani"));
  }
  
  /**
   * ensures that good and bad inputs are correctly flagged.
   */
  @Test
  public void testGauntlet() {
    MonitorPower mp1 = new MonitorPower(client, "LokeDizzle");
    MonitorPower mp2 = new MonitorPower(client, "");
    assertTrue("mp should be true", mp.getResult());
    assertFalse("LokeDizzle isn't valid", mp1.getResult());
    assertFalse("Nothing isn't valid", mp2.getResult());
  }
}
